//PHP Connection script
MYSQL_CONNECT("localhost","jpn_admin","Admin@Yahoo.com") or die(mysql_error());
mysql_select_db("jpn_com_-_db");
if (!ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
extract($superglobal, EXTR_SKIP);
}
}
function jpnPrint($str)
{
return stripslashes($str);
}
function jpnClean($str)
{
return addslashes($str);
}
function selectDate (
$sel_d = 0 // selected day
, $sel_m = 0 // selected month
, $sel_y = 0 // selected year
, $var_d = 'd' // name for day variable
, $var_m = 'm' // name for month variable
, $var_y = 'y' // name for year variable
, $min_y = 0 // minimum year
, $max_y = 0 // maximum year
, $enabled = true // enable drop-downs?
) {
// --------------------------------------------------------------------------
// First of all, set up some sensible defaults
// Default day is today
if ($sel_d == 0)
$sel_d = date('j');
// Default month is this month
if ($sel_m == 0)
$sel_m = date('n');
// Default year is this year
if ($sel_y == 0)
$sel_y = date('Y');
// Default minimum year is this year
if ($min_y == 0)
$min_y = date('Y');
// Default maximum year is two years ahead
if ($max_y == 0)
$max_y = ($min_y + 2);
// --------------------------------------------------------------------------
// Now do the drop-down for Months
// Start opening the select element
echo '';
// --------------------------------------------------------------------------
// Start off with the drop-down for Days
// Start opening the select element
echo '';
// --------------------------------------------------------------------------
// Finally, the drop-down for Years
// Start opening the select element
echo '';
}
function selectTime($hour = 0, $min = 0, $ap = 'pm',$var_h = 'hour',$var_m = 'min',$var_ap='ampm')
{
$printHour = 0;
$printMin = 0;
if($hour == 0)
$printHour = 9;
else
$printHour = $hour;
if($min == 0)
$printMin = 0;
else
$printMin = $min;
$startHour = 1;
echo "\n";
$startMin = 0;
echo "\n";
echo "\n";
}
$mysql_datetime = date('Y-m-d H:i:s');
$mysql_date = date('Y-m-d');
$mysql_time = date('H:i:s');
function convertPHPTimeToMySQLTime($hour,$minute,$ampm)
{
if($ampm == "am")
{
if ($hour == 12)
return "0".":".$minute.":00";
else
return $hour.":".$minute.":00";
}
else
{
if ($hour == 12)
return "12".":".$minute.":00";
else
return ($hour+12).":".$minute.":00";
}
}
function convertPHPDateToMySQLDate($day,$month,$year)
{
return str_pad($year, 2, "0", STR_PAD_LEFT)."-".str_pad($month, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT);
}
function getDay($str)
{
$pieces = explode("-", $str);
return $pieces[2];
}
function getMonth($str)
{
$pieces = explode("-", $str);
return $pieces[1];
}
function getYear($str)
{
$pieces = explode("-", $str);
return $pieces[0];
}
function getHour($str)
{
$pieces = explode(":",$str);
if($pieces[0] > 12)
$pieces[0] -= 12;
if($pieces[0] == "00")
$pieces[0] = 12;
return $pieces[0];
}
function getMin($str)
{
$pieces = explode(":",$str);
return $pieces[1];
}
function getAP($str)
{
$pieces = explode(":",$str);
if($pieces[0] >= 12)
return "pm";
return "am";
}
function dateFromMysqlToNormal($str)
{
return date("D, F jS Y", strtotime($str));
}
function timeFromMysqlToNormal($str)
{
return date("h:i A", strtotime($str));
}
?>